<script setup lang="ts">
// 监听改变
import { ref, watch } from "vue"

interface Student {
  name: string
  age: number
}
let xiaoMing:Student={
   name:"测试" ,
   age:18
}

let num = ref(xiaoMing)

watch(
  num,
  (newVal, oldVal) => {
    console.log("新的值：", newVal)
    console.log("旧的值：", oldVal)
  },
  { immediate: true, deep: true }
)
</script>

<template>
  {{ num.age }}
  <input type="text" v-model="num.age" />
</template>

<style>

</style>
